<?php
	include_once "xAP-functions/webincludes.php";


$results=dbquery("Select distinct Category from xAP_News_Source order by Category");
foreach($results as $r){
	$cat[]=array("title"=>$r["Category"],"function"=>"Category","id"=>$r["Category"]);
}

$results=dbquery("Select SourceID,Alias from xAP_News_Source order by Alias");
foreach($results as $r){
	$item[]=array("title"=>$r["Alias"],"function"=>"NewsLoad","id"=>$r["SourceID"]);
}

$q="?";
header("Content-type: text/xml");
?>
<<?=$q?>xml version="1.0" encoding="UTF-8"?>
<root>
<title set="waNewsList">Sources</title>
<part>
<destination mode="replace" zone="waNewsList" create="true"/>
<data><![CDATA[
<div class="iMenu">
<h3>Categories</h3>
<UL class='iArrow'>
<? foreach($cat as $v):?>
<LI class='iArrow'><a href='/News/iphone_stories.php?cat=<?=$v["id"]?>#_NewsStories' rev="async"><?=$v["title"];?></a></LI>
<? endforeach; ?>
</UL>
<h3>Feeds</h3>
<UL class='iArrow'>
<? foreach($item as $v):?>
<LI class='iArrow'><a href='/News/iphone_stories.php?id=<?=$v["id"]?>#_NewsStories' rev="async"><?=$v["title"];?></a></LI>
<? endforeach; ?>
</UL>
</div>
]]></data>
</part>
</root>